﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace FrameworkCore.Data;

public abstract class HookingDbContext : DbContext
{
    private static readonly ValueConverter _dateTimeConverter =
        new ValueConverter<DateTime, DateTime>(
            v => v,
            v => DateTime.SpecifyKind(v, DateTimeKind.Utc));

    private static readonly ValueConverter _nullableDateTimeConverter =
        new ValueConverter<DateTime?, DateTime?>(
            v => v,
            v => v.HasValue ? DateTime.SpecifyKind(v.Value, DateTimeKind.Utc) : v);

    public HookingDbContext(DbContextOptions options)
        : base(options)
    {
        Options = options;
    }

    protected internal virtual DbContextOptions Options { get; }
}
